#include<stdio.h>
int main()
{
	int n, m, t;
	int a[100];
	scanf("%d %d\n", &n, &m);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
	}
	for (int i = 0; i < m; i++)
	{
		t = a[n - 1];
		for (int j = n - 1; j > 0; j--)
		{
			a[j] = a[j - 1];
		}
		a[0] = t;
	}
	for (int i = 0; i < n; i++)
	{
		if (i == n - 1)
			printf("%d", a[i]);
		else
			printf("%d ", a[i]);
	}
}